Add only_authenticated
option to the client
#7545
Merged
+81
−39
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When sending an upload request, we use an HTTP formdata request, which can't be cloned (seanmonstar/reqwest#2416, plus a limitation that formdata bodies are always internally streaming), but we also know that we need to always have credentials.
The authentication middleware by default tries to clone the request and send an authenticated request first. By introducing an
only_authenticated
setting, we can skip this behaviour for publishing.The second change i rolled in here is not adding the retry middleware when retries are 0, since the retry middleware would always clone the request (it needs to store a copy in case the request fails).
I'm open to switching to any different workaround for the cloneable-request problem.
Split out from #7475